package mapper;


import bean.Student;
import org.apache.ibatis.annotations.*;
import sql.ReturnSql;

import java.util.List;

public interface StudentMapper {
    //查询全部
    //@Select("select * from student")
    @SelectProvider(type = ReturnSql.class,method = "getSelectAll")
    public abstract List<Student> selectAll();

    //增加
    //  是否使用注解    数据表中列名     类中属性名
   // @Options(useGeneratedKeys = true, keyColumn ="id" ,keyProperty = "id")
   // @Insert("insert into student values(#{id},#{name},#{age})")

   @InsertProvider(type = ReturnSql.class, method = "getInsert")
    public abstract Integer insert(Student stu);

    //修改
    //@Update("update student set name=#{name},age=#{age} where id=#{id}")
    @UpdateProvider(type = ReturnSql.class, method = "getUpdate")
    public  abstract  Integer update(Student stu);

    //删除
   // @Delete("delete from student where id=#{id}")
    @DeleteProvider(type = ReturnSql.class, method = "getDelete")
    public abstract Integer delete(Integer id);
}
